package com.moon.cloud.common.exception;

import lombok.Getter;

import java.io.Serial;

@Getter
public class MoonException extends RuntimeException {

    @Serial
    private static final long serialVersionUID = 1L;

    private final int errorCode;

    public MoonException() {
        this(500, "系统异常");
    }

    public MoonException(String message) {
        this(500, message);
    }

    public MoonException(int errorCode) {
        this(errorCode, "Error occurred with code: " + errorCode);
    }

    public MoonException(int errorCode, String message) {
        super(message);
        this.errorCode = errorCode;
    }

    public MoonException(int errorCode, String message, Throwable cause) {
        super(message, cause);
        this.errorCode = errorCode;
    }

    public MoonException(String message, Throwable cause) {
        this(500, message, cause);
    }

}
